//
//  SpecialViewCell.m
//  phmall
//
//  Created by admin on 2017/11/29.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "SpecialViewCell.h"

@implementation SpecialViewCell
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self){
        self.contentView.backgroundColor=[UIColor whiteColor];
        
        self.cellImage=[[UIImageView alloc]init];
        self.cellImage.image=[UIImage imageNamed:@"图片"];
        [self.contentView addSubview:self.cellImage];
        
        self.name=[[UILabel alloc]init];
        self.name.font=[UIFont systemFontOfSize:10];
        self.name.text=@"THE KOOPLES";
        [self.contentView addSubview:self.name];
        
        self.style=[[UILabel alloc]init];
        self.style.font=[UIFont systemFontOfSize:10];
        self.style.text=@"白色经典款";
        self.style.textColor=[UIColor colorWithHexString:@"#adadad"];
        [self.contentView addSubview:self.style];
        
        self.price=[[UILabel alloc]init];
        self.price.font=[UIFont systemFontOfSize:10];
        self.price.text=@"₱6666.00";
        self.price.textColor=[UIColor orangeColor];
        [self.contentView addSubview:self.price];
        
    }
    
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    CGSize superSize = self.contentView.frame.size;
    
    if (CGSizeEqualToSize(superSize, CGSizeZero)) {
        return;
    }
    
    
    [self.cellImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).with.offset(0);
        make.left.equalTo(self.contentView).with.offset(0);
        make.right.equalTo(self.contentView).with.offset(0);
        make.height.equalTo(self.cellImage.mas_width);
    }];

    [self.name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.with.offset(10);
        make.top.equalTo(self.cellImage.mas_bottom).with.offset(3);
    }];
    
    [self.style mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.with.offset(10);
        make.top.equalTo(self.name.mas_bottom).with.offset(3);
    }];
    
    [self.price mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.with.offset(10);
        make.top.equalTo(self.style.mas_bottom).with.offset(3);
    }];
    
    
}
-(void)setModel:(GoodsModel *)model{
    _model=model;
    [self.cellImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@union/%@",IMGURL,model.goods_file1]] placeholderImage:[UIImage imageNamed:@"图片空白页(小图)"]];
    self.name.text=model.goods_name;
    self.price.text=model.goods_sale_price;
    //
}
@end
